﻿using System.Collections.ObjectModel;

namespace MiniFox.Components.Configurations
{
    /// <summary>
    /// 组件配置集合
    /// </summary>
    public class ComponentConfigCollection : KeyedCollection<string, ComponentConfig>, IComponentConfigCollection
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        IComponentConfig IComponentConfigCollection.this[string name] => this[name];

        /// <summary>
        /// 
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        protected override string GetKeyForItem(ComponentConfig item)
        {
            return item.ContractType;
        }

        IEnumerator<IComponentConfig> IEnumerable<IComponentConfig>.GetEnumerator()
        {
            return this.GetEnumerator();
        }
    }
}
